//
//  CutomCell.m
//  作业tableView通讯录
//
//  Created by dllo on 16/6/17.
//  Copyright © 2016年 zuzhiming. All rights reserved.
//

#define MAS_SHORTHAND
#define MAS_SHORTHAND_GLOBALS
#import "CutomCell.h"
#import "Masonry.h"
#import "DetailsInfoView.h"
@interface CutomCell ()



@end


@implementation CutomCell


- (void)dealloc
{
    [_leftImageView release];
    [_nameLabel release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}

- (void)createSubViews
{
    
    self.leftImageView = [[UIImageView alloc] init];
    self.leftImageView.backgroundColor = [UIColor orangeColor];
       [self.contentView addSubview:_leftImageView];
    [_leftImageView release];
    
    self.nameLabel = [[UILabel alloc] init];
//    self.nameLabel.backgroundColor = [UIColor greenColor];
    
    //第三步
//    DetailsInfoView *deiv = [[DetailsInfoView alloc] init];
//    [self.pvDelegate passValueWithName:deiv.content.text];
//    [deiv release];
    
    
    [self.contentView addSubview:_nameLabel];
    [_nameLabel release];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    [self.leftImageView makeConstraints:^(MASConstraintMaker *make) {
       
        make.edges.offset(UIEdgeInsetsMake(8, 8, 8, CGRectGetWidth(self.bounds) - 107));
        self.leftImageView.layer.cornerRadius = 42;

        self.leftImageView.layer.masksToBounds = YES;

    }];
    
    [self.nameLabel makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.top).offset(10);
        make.left.equalTo(self.leftImageView.right).offset(20);
        make.bottom.equalTo(self.contentView.bottom).offset(-10);
        make.right.equalTo(self.contentView.right).offset(-30);
    }];
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
//    self.backgroundColor = [UIColor greenColor];
}

@end
